package edu.langnan.xiaoli;

import edu.langnan.xiaoli.core.dto.WeiXinLoginResultDTO;
import edu.langnan.xiaoli.service.WeiXinService;
import edu.langnan.xiaoli.utils.SecurityUtils;
import edu.langnan.xiaoli.utils.http.HttpUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.text.MessageFormat;

/**
 * @author cql
 */
@SpringBootTest
class DemoApplicationTests {

    @Autowired
    private WeiXinService weiXinService;

    @Test
    public void test1() {
        String s = SecurityUtils.encryptPassword("123456");
        System.out.println(SecurityUtils.matchesPassword(s, s));
        System.out.println(s);

    }


    @Test
    public void test2() {
        String msg = "你是?我是{0}";
        String ccc = MessageFormat.format(msg, "ccc");
        System.out.println(ccc);
    }

    @Test
    public void test3() {
        // {"session_key":"ALyiTuVnaiEGzO8HLiWilQ==","openid":"oPDQe5NdaF4CgnEVdtQhEMGH-aJc"}
        // {"session_key":"QvEffXmcSkMQ9dXp8CEsDQ==","openid":"oPDQe5NdaF4CgnEVdtQhEMGH-aJc"}
        // {"errcode":40163,"errmsg":"code been used, rid: 625ab08a-7269cca3-7f8705f7"}
        WeiXinLoginResultDTO weiXinLoginResultDTO = weiXinService.weiXinLogin("0816JM000vw4FN1Etp200eEHS826JM0C");
        System.out.println(weiXinLoginResultDTO);
    }

}
